package nl.jteam.jsa.core;

import java.util.Set;

/**
 * Represents a facet of the search engine corpus.
 *
 * @author Uri Boness
 */
public interface Facet {

    /**
     * Returns the name of the facet. Usually will correspond to a document field name (but not required to be so). A
     * facet name is unique among all facets in a search engine corpus.
     *
     * @return The name of the facet.
     */
    String getName();

    /**
     * Returns the entries of this facet.
     *
     * @return The entries of this facet.
     */
    Set<FacetEntry> getEntries();

    /**
     * Merges the entries of the given facet with this one. Note that the given facet <b>MUST</b> be of the same type
     * (i.e. have the same facet name) as this one.
     *
     * @param facet The facet of which entries will be merged with this facet.
     * @throws IllegalArgumentException if the given facet is not of the same type as this facet
     *         (does not have the same name).
     */
    void merge(Facet facet);

}

